'use strict';

var fangfa ={
    name : 'admin',
    password : '123456',
    birth: '2020',
     age: function () {
        var y = new Date().getFullYear();
        return y - this.birth;
     }
};
fangfa.age; // function xiaoming.age()
fangfa.age(); 
console.log(fangfa.age());

/*-------------------------------------*/

function getAge() {
    var y = new Date().getFullYear();
    return y - this.birth;
}

var xiaoming = {
    name: '小明',
    birth: 1990,
    age: getAge
};
console.log(xiaoming.age());



var count = 0;
var oldParseInt = 0; // 保存原函数

window.parseInt = function () {
    count += 1;
    return oldParseInt.apply(null, arguments); // 调用原函数
};
// 测试:
parseInt('10');
parseInt('20');
parseInt('30');
parseInt('40');
parseInt('50');
parseInt('60');
console.log('count = ' + count); // 3
